//
//  REdateTableViewCell.m
//  录音
//
//  Created by ywy on 2016/12/27.
//  Copyright © 2016年 Wely. All rights reserved.
//

#import "REdateTableViewCell.h"
#import "RECheckLogin.h"
#import <SVProgressHUD.h>
#import "RESingleton.h"

@implementation REdateTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.bigView.layer.borderColor = RERGBColor(225, 225, 225).CGColor;
    self.bigView.layer.masksToBounds = NO;
    //设置阴影的颜色
    self.bigView.layer.shadowColor=RERGBColor(225, 225, 225).CGColor;
    //设置阴影的偏移量，如果为正数，则代表为往右边偏移
    self.bigView.layer.shadowOffset=CGSizeMake(1, 1);
    //设置阴影的透明度(0~1之间，0表示完全透明)
    self.bigView.layer.shadowOpacity=0.5;
    
    self.progressView.layer.masksToBounds = YES;
    self.progressView.layer.cornerRadius = 5;
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, REScreenW-20, self.backVIew.frame.size.height) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = CGRectMake(0, 0, REScreenW-20, self.backVIew.frame.size.height);
    maskLayer.path = maskPath.CGPath;
    self.backVIew.layer.mask = maskLayer;
    
    [self.progressView setProgressTintColor:[UIColor whiteColor]];
    [self.progressView setTrackTintColor:RERGBColor(249, 182, 70)];
     //Initialization code
     self.ispaly = YES;
     [self.selfPlayer.currentItem removeObserver:self  forKeyPath:@"status"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}
-(void)showDate:(ReRecordModel*)model withIndexPath:(NSIndexPath*)playIndexPath
{
    
    
//    self.indexPath = playIndexPath;
    self.baseModel = model;
    YPLog(@"打印出来每一个的数据的信息%@",model.isClas);
    
    if ([model.titleStr isEqualToString:@"RE"]) {
        self.titleLabel.text = @"未命名";
    }else
    {
          self.titleLabel.text = model.titleStr;
    }
    
    if (![model.isUpPost isEqualToString:@"noUp"]) {
        [self.postButton setImage:[UIImage imageNamed:@"uploaded"] forState:UIControlStateNormal];
    }else
    {
        [self.postButton setImage:[UIImage imageNamed:@"up"] forState:UIControlStateNormal];
    }
    
    
    if (![model.isClas isEqualToString:@"noClass"]) {
        
        [self.notClassButton setImage:[UIImage imageNamed:@"reclassified"] forState:UIControlStateNormal];
        self.samllView.hidden = NO;
        self.smallTitleLabel.text = model.albumName;
        
    }else
    {
        self.samllView.hidden = YES;
        [self.notClassButton setImage:[UIImage imageNamed:@"classified_Album"] forState:UIControlStateNormal];
    }
    self.totalTimeLabel.text = [NSString stringWithFormat:@"/ %@",model.currentTime];
    
}
// 播放
- (IBAction)playClick:(UIButton *)sender {
        sender.selected =  !sender.selected;
    if (_play) {
        _play(self.baseModel,sender.selected,10001,self,_indexPath);
    }
}

// 删除
- (IBAction)deletClick:(UIButton *)sender {
    if (_play) {
        _play(self.baseModel,NO,10002,self,_indexPath);
    }
}

// 上传
- (IBAction)upClicK:(UIButton *)sender {
    if (_play) {
        _play(self.baseModel,NO,10003,self,_indexPath);
    }
}

// 归类
- (IBAction)classifiedAlbumClick:(UIButton *)sender {
    if (_play) {
        _play(self.baseModel,NO,10004,self,_indexPath);
    }
}

@end
